<!-- 修改手机号 -->
<template>
    <div>
        <div>
            <a-form :label-col="{ span: 6 }" :wrapper-col="{ span: 17 }">
                <a-form-item label="用户手机号">
                    <a-input v-model="oldPhone" placeholder="请输入用户手机号" allow-clear></a-input>
                </a-form-item>
                <!-- <a-form-item label="新手机号">
                    <a-input v-model="newPhone" placeholder="请输入用户新手机号" allow-clear></a-input>
                </a-form-item> -->
                <a-form-item  v-bind="formItemLayoutWithOutLabel">
                    <a-button type="primary" @click="register">立即注销</a-button>
                </a-form-item>
            </a-form>
        </div>
    </div>
</template>

<script>
import { updateUserPhone } from '@/api/member';
export default {
    data () {
        return {
            brandId: this.global.brandId,
            oldPhone: '', // 原手机号
            newPhone: '', // 新手机号
            formItemLayoutWithOutLabel: {
                wrapperCol: {
                    xs: { span: 24, offset: 0 },
                    sm: { span: 20, offset: 6 },
                },
            },
            brandList: [],
        };
    },
    created(){ 
    },
    methods: {
        changePass(val){
            if(val==1){
              this.password='a123456'  
            }else{
                this.password='111111'  
            }
        },
        register(){
            let _this = this
            if(!_this.brandId){
                _this.$message.warning('请选择品牌')
                return
            }
            if(_this.oldPhone == '' || _this.oldPhone.length != 11){
                _this.$message.warning('请输入正确的原手机号')
                return
            }
            // if(_this.newPhone == '' || _this.newPhone.length != 11){
            //     _this.$message.warning('请输入正确的新手机号')
            //     return
            // }
            const params = {
                'brandId':_this.brandId,
                'oldPhone':_this.oldPhone,
                'newPhone':`${_this.oldPhone}-已注销`,
            }
            updateUserPhone(params)
            .then(res=>{
                if(res.success){
                    _this.account=''
                    _this.$notification['success']({
                        message: '提示',
                        description: '注销成功',
                        duration: 8,
                    })
                }else{
                    _this.$notification['error']({
                        message: '提示',
                        description: res.errMessage,
                        duration: 8,
                    })
                }
            })
        },
    }
}

</script>
<style scoped>

</style>